package com.jw.qiliprj.maintab.adapter

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.viewpager2.adapter.FragmentStateAdapter

import com.cysd.ewmxns.ui.fragment.IndexFragment
import com.cysd.ewmxns.ui.fragment.QrCodeFragment
import com.cysd.ewmxns.ui.fragment.WodeFragment


// ViewPagerAdapter.kt
class ViewPagerAdapter(fragmentActivity: FragmentActivity) : FragmentStateAdapter(fragmentActivity) {

    override fun getItemCount(): Int {
        return 3
    }

    override fun createFragment(position: Int): Fragment {
        return when (position) {
            0 -> IndexFragment()
            1 -> QrCodeFragment()
            2 -> WodeFragment()
            else -> throw IllegalArgumentException("Invalid position")
        }
    }
}